import json
# 读取json.txt中的信息
with open("json.txt", "r", encoding="utf-8") as file:
    user_data = json.load(file)
# 编写UserInfo类
class UserInfo:
    def __init__(self, username, password, email):
        self.username = username
        self.password = password
        self.email = email
    # 输出每个用户的基本信息
    def __str__(self):
        return f"用户的姓名：{self.username}\n用户的邮箱：{self.email}\n"
# 封装用户数据
users = []
for item in user_data:
    user = UserInfo(
        username=item['username'],
        password=item['password'],
        email=item['email']
    )
    users.append(user)
# 遍历输出用户信息
for user in users:
    print(user)